// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsIXULWindow.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    /// The nsIXULWindow
    ///
    /// When the window is destroyed, it will fire a "xul-window-destroyed"
    /// notification through the global observer service.
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("d6d7a014-e28d-4c9d-8727-1cf6d870619b")]
	public interface nsIXULWindow
	{
		
		/// <summary>
        /// The docshell owning the XUL for this window.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDocShell GetDocShellAttribute();
		
		/// <summary>
        /// Indicates if this window is instrinsically sized.	
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetIntrinsicallySizedAttribute();
		
		/// <summary>
        /// Indicates if this window is instrinsically sized.	
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetIntrinsicallySizedAttribute([MarshalAs(UnmanagedType.U1)] bool aIntrinsicallySized);
		
		/// <summary>
        /// The primary content shell.
        ///
        /// Note that this is a docshell tree item and therefore can not be assured of
        /// what object it is. It could be an editor, a docshell, or a browser object.
        /// Or down the road any other object that supports being a DocShellTreeItem
        /// Query accordingly to determine the capabilities.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDocShellTreeItem GetPrimaryContentShellAttribute();
		
		/// <summary>
        /// In multiprocess case we may not have primaryContentShell but
        /// primaryTabParent.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsITabParent GetPrimaryTabParentAttribute();
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void TabParentAdded([MarshalAs(UnmanagedType.Interface)] nsITabParent aTab, [MarshalAs(UnmanagedType.U1)] bool aPrimary);
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void TabParentRemoved([MarshalAs(UnmanagedType.Interface)] nsITabParent aTab);
		
		/// <summary>
        /// The content shell specified by the supplied id.
        ///
        /// Note that this is a docshell tree item and therefore can not be assured of
        /// what object it is.  It could be an editor, a docshell, or a browser object.
        /// Or down the road any other object that supports being a DocShellTreeItem
        /// Query accordingly to determine the capabilities.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDocShellTreeItem GetContentShellById([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.WStringMarshaler")] string ID);
		
		/// <summary>
        /// Tell this window that it has picked up a child XUL window
        /// @param aChild the child window being added
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void AddChildWindow([MarshalAs(UnmanagedType.Interface)] nsIXULWindow aChild);
		
		/// <summary>
        /// Tell this window that it has lost a child XUL window
        /// @param aChild the child window being removed
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void RemoveChildWindow([MarshalAs(UnmanagedType.Interface)] nsIXULWindow aChild);
		
		/// <summary>
        /// Move the window to a centered position.
        /// @param aRelative If not null, the window relative to which the window is
        /// moved. See aScreen parameter for details.
        /// @param aScreen   PR_TRUE to center the window relative to the screen
        /// containing aRelative if aRelative is not null. If
        /// aRelative is null then relative to the screen of the
        /// opener window if it was initialized by passing it to
        /// nsWebShellWindow::Initialize. Failing that relative to
        /// the main screen.
        /// PR_FALSE to center it relative to aRelative itself.
        /// @param aAlert    PR_TRUE to move the window to an alert position,
        /// generally centered horizontally and 1/3 down from the top.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void Center([MarshalAs(UnmanagedType.Interface)] nsIXULWindow aRelative, [MarshalAs(UnmanagedType.U1)] bool aScreen, [MarshalAs(UnmanagedType.U1)] bool aAlert);
		
		/// <summary>
        /// Shows the window as a modal window. That is, ensures that it is visible
        /// and runs a local event loop, exiting only once the window has been closed.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void ShowModal();
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint GetZLevelAttribute();
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetZLevelAttribute(uint aZLevel);
		
		/// <summary>
        /// contextFlags are from nsIWindowCreator2
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint GetContextFlagsAttribute();
		
		/// <summary>
        /// contextFlags are from nsIWindowCreator2
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetContextFlagsAttribute(uint aContextFlags);
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint GetChromeFlagsAttribute();
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetChromeFlagsAttribute(uint aChromeFlags);
		
		/// <summary>
        /// Begin assuming |chromeFlags| don't change hereafter, and assert
        /// if they do change.  The state change is one-way and idempotent.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void AssumeChromeFlagsAreFrozen();
		
		/// <summary>
        /// Create a new window.
        /// @param aChromeFlags see nsIWebBrowserChrome
        /// @param aOpeningTab the TabParent that requested this new window be opened.
        /// Can be left null.
        /// @return the newly minted window
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIXULWindow CreateNewWindow(int aChromeFlags, [MarshalAs(UnmanagedType.Interface)] nsITabParent aOpeningTab);
		
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIXULBrowserWindow GetXULBrowserWindowAttribute();
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetXULBrowserWindowAttribute([MarshalAs(UnmanagedType.Interface)] nsIXULBrowserWindow aXULBrowserWindow);
		
		/// <summary>
        /// Back-door method to force application of chrome flags at a particular
        /// time.  Do NOT call this unless you know what you're doing!  In particular,
        /// calling this when this XUL window doesn't yet have a document in its
        /// docshell could cause problems.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void ApplyChromeFlags();
	}
	
	/// <summary>nsIXULWindowConsts </summary>
	public class nsIXULWindowConsts
	{
		
		// 
		public const ulong lowestZ = 0;
		
		// 
		public const ulong loweredZ = 4;
		
		// <summary>
        //"alwaysLowered" attribute </summary>
		public const ulong normalZ = 5;
		
		// 
		public const ulong raisedZ = 6;
		
		// <summary>
        //"alwaysRaised" attribute </summary>
		public const ulong highestZ = 9;
	}
}
